package com.jia.train.seat.enums;

import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;

public enum SeatColEnum {

    YDZ_A("A", "A", "1"),
    YDZ_C("C", "C", "1"),
    YDZ_D("D", "D", "1"),
    YDZ_F("F", "F", "1"),
    EDZ_A("A", "A", "2"),
    EDZ_B("B", "B", "2"),
    EDZ_C("C", "C", "2"),
    EDZ_D("D", "D", "2"),
    EDZ_F("F", "F", "2"),
    RW_A("A", "A", "3"),
    RW_B("B", "B", "3"),
    YW_A("A", "A", "4"),
    YW_B("B", "B", "4"),
    ;
    private String code;

    private String desc;

    private String type;

    SeatColEnum(String code, String desc, String type) {
        this.code = code;
        this.desc = desc;
        this.type = type;
    }

    /**
     * 根据车厢的座位类型 筛选所有的列
     *
     * @param seatType
     * @return
     */
    public static List<SeatColEnum> getColsByType(String seatType) {
        List<SeatColEnum> list = new ArrayList<>();
        EnumSet<SeatColEnum> seatColEnums = EnumSet.allOf(SeatColEnum.class);
        for (SeatColEnum seatColEnum : seatColEnums) {
            if (seatType.equals(seatColEnum.type)) {
                list.add(seatColEnum);
            }
        }
        return list;
    }

    public String getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    public String getType() {
        return type;
    }
}
